//管理员查看的每月考勤
$(document).ready(function(){    
	//每月考勤     
	$("#schoolMonInfo").jqGrid({                
		url:global_url+global_urijs+'schoolmon_searchATMList_admin'+global_suffix+"?sid="+global_sid,                
		datatype:"json",                
		mtype:'GET', 
		height:'300',
		width:'720',                 
		colNames:['姓名','职务','全勤','实际考勤','缺勤','迟到','早退','累计缺勤(分钟)','请假(小时)','加班(小时)','年月','异常时长(小时)','考勤编号'],                
		colModel:[                    
		{name:'teacherName',index:'teacherName',width:80,align:'center'},                    
		{name:'typeName',index:'typeName',width:80,align:'center'},                    
		{name:'full',index:'full',width:80, align:'center'},
		{name:'attendance',index:'attendance',width:80,align:'center'},
		{name:'absenteeism',index:'absenteeism',width:80,align:'center'},
		{name:'late',index:'late',width:80,align:'center'},
		{name:'early',index:'early',width:80,align:'center'},
		{name:'accumulation',index:'accumulation',width:120,align:'center'},
		{name:'leave',index:'leave',width:100,align:'center'},
		{name:'overtime',index:'overtime',width:100,align:'center'},
		{name:'date',index:'date',width:80,align:'center'},
		{name:'time_exc',index:'time_exc',width:150,align:'center',sortable:false},
		{name:'taid',index:'taid',hidden:true}
		],
		//autowidth:true,
		jsonReader: {
			root:"attMonths",
			page: "page",
			total: "page_count",
			records : "count",
			repeatitems: false
		},
		pager: jQuery("#schoolMonPage"),
		prmNames : {page:"page",sort: "sort"},
		rowNum: 10,
		//rowList: [10, 20, 30],
		sortname: 'teacherName',
		hidegrid: false,
		sortorder: 'asc',
		viewrecords: true,
		caption: '每月考勤信息',
		gridComplete:function(){
			var ids=jQuery("#schoolMonInfo").jqGrid('getDataIDs');
			for(var i=0; i<ids.length; i++){
				var id=ids[i];   
				
				jQuery("#schoolMonInfo").jqGrid('setRowData', ids[i]);
			}
		}
	}).navGrid("#schoolMonPage", { edit: false, add: false, del: false, search: false });
	
	
	
	//考勤明细
	$("#detailsinfo").jqGrid({                
		url:global_url+global_urijs+'schoolmon_searchADList_admin'+global_suffix+"?sid="+global_sid,                
		datatype:"json",                
		mtype:'GET',   
		height:'300',
		width:'720',               
		colNames:['员工姓名','出入校园','时间','照片','类型','照片地址'],                
		colModel:[                    
		{name:'teacherName',index:'teacherName',width:100,align:'center'},                    
		{name:'type_str',index:'type_str',width:100,align:'center'},                    
		{name:'cdate_str',index:'cdate_str',width:160, align:'center'},
		{name:'option',index:'option',width:160,align:'center', sortable:false},
		{name:'type',index:'type',width:120,align:'center',sortable:false,hidden:true},
		{name:'img',index:'img',width:120,align:'center',sortable:false,hidden:true}
		],
		//autowidth:true,
		jsonReader: {
			root:"attDetails",
			page: "page",
			total: "page_count",
			records : "count",
			repeatitems: false
		},
		pager: jQuery("#detailspage"),
		prmNames : {page:"page",sort: "sort"},
		rowNum: 10,
		//rowList: [10, 20, 30],
		sortname: 'teacherName',
		hidegrid: false,
		sortorder: 'asc',
		viewrecords: true,
		caption: '考勤明细',
		gridComplete:function(){
			var ids=jQuery("#detailsinfo").jqGrid('getDataIDs');
			for(var i=0; i<ids.length; i++){
				var id=ids[i];  
				var img_url = jQuery("#detailsinfo").jqGrid('getRowData', id).img;
				var type = jQuery("#detailsinfo").jqGrid('getRowData', id).type;
				var urlpath = global_teacherin_url;
				if(type==2){
					urlpath = global_teacherout_url;
				}
				if(img_url==null||img_url==""){
					ifo = "";
				}else{
					ifo = "<a href='"+urlpath+img_url+"' class='jqtrow' target='_blank'><img src='"+urlpath+"small/"+img_url+"' height='30px' width='30px'></a>";
				}
				jQuery("#detailsinfo").jqGrid('setRowData', ids[i], {option:ifo});
			}
		}
	}).navGrid("#detailspage", { edit: false, add: false, del: false, search: false });
	
	//异常请假信息
	$("#leaveinfo").jqGrid({                
		url:global_url+global_urijs+'schoolmon_searchLeaveList_admin'+global_suffix+"?sid="+global_sid,                
		datatype:"json",                
		mtype:'GET', 
		height:'300',
		width:'720',                 
		colNames:['姓名','开始时间','结束时间','请假时长(小时)','类型','事由','状态'],                
		colModel:[                    
		{name:'teacherName',index:'teacherName',width:100,align:'center'},                    
		//{name:'tAccount',index:'tAccount',width:100,align:'center'},                    
		//{name:'typeName',index:'typeName',width:100,align:'center'},
		{name:'sdate_str',index:'sdate_str',width:150,align:'center'},
		{name:'edate_str',index:'edate_str',width:150,align:'center'},
		{name:'leaveTime',index:'leaveTime',width:120,align:'center'},
		{name:'type_handle_str',index:'type_handle_str',width:100,align:'center',sortable:false},
		{name:'desinfo',index:'desinfo',width:150,align:'center',sortable:false},
		{name:'state_str',index:'state_str',width:100,align:'center',sortable:false},
		],
		//autowidth:true,
		jsonReader: {
			root:"terLeaves",
			page: "page",
			total: "page_count",
			repeatitems: false
		},
		pager: jQuery("#leavepage"),
		prmNames : {page:"page",sort: "sort"},
		rowNum: 10,
		//rowList: [10, 20, 30],
		sortname: 'sdate_str',
		hidegrid: false,
		sortorder: 'dasc',
		viewrecords: true,
		caption: '异常信息'
	}).navGrid("#leavepage", { edit: false, add: false, del: false, search: false });
});




